/*
 * Year2000FillFixer.java
 *
 * Created on August 27, 2002, 1:44 PM
 *
 * Copyright (c) 2002 The General Electric Company
 */

package com.ge.healthcare.autosc.processor.magmon.y2k;

/**
 * Fixes year-2000 compliance problems for ASCII files which are in
 *  fill.dat or magdata.dat format.  Two digit years are converted to
 *  four digit years by prefixing them with 19.
 *
 * @author Daniel S. Horwitz, Compuware Corp.
 *
 * @version AutoSC P5P6
 */
public class Year2000FillFixer implements Year2000Fixer
{
    /**
     * Construct a year-2000 fixer for fill.dat or magdata.dat format
     *  files.
     */
    public Year2000FillFixer()
    {
        super();
    }

    /**
     * Get a year-2000 compliant version of the specified line of data.
     *
     * @param sourceLine The line of source data.
     *
     * @return A year-2000 compliant version of the source data.
     */
    public String getCompliant( String sourceLine )
    {
        if ( sourceLine.charAt( 2 ) == '/' )
        {
            return "19" + sourceLine;
        }
        else if ( (sourceLine.charAt( 0 ) == '_') &&
                  (sourceLine.charAt( 3 ) == '/') )
        {
            return "19" + sourceLine.substring( 1 );
        }
        else
        {
            return sourceLine;
        }
    }
}
